UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ijMtB+NvRMJgpbak+VgnwrHzIsTqMlZiYP0lhTWDKOs=' 
WHERE 
  key_id = '06cf0d0ee15db9b77a924b478dcb7e6efe5df0f9db7bb404fc7769806744f58b' 
  AND (
    token = 'ijMtB+NvRMJgpbak+VgnwrHzIsTqMlZiYP0lhTWDKOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026