UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MId3J+ENGHu7VEaXOZPGVHr8+FPwS69pdPgKomqk8uM=' 
WHERE 
  key_id = '5b9b984c7ec49a1d187616b838063ef184fa26b3bcd4593854c77653dd2da44d' 
  AND (
    token = 'MId3J+ENGHu7VEaXOZPGVHr8+FPwS69pdPgKomqk8uM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017