UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hlc1ATWJ8lRZeY7rqXQm/cv4IGCGOjy87LUZtZjMhLo=' 
WHERE 
  key_id = '8bf8adb532145afc007741e392abc8055f9739baa0a4db334e10f18a95f0470a' 
  AND (
    token = 'hlc1ATWJ8lRZeY7rqXQm/cv4IGCGOjy87LUZtZjMhLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042