UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WTGp9ymVyaaGGcspv/kj6O8LsMk/EcaOmXM5eU4OCVw=' 
WHERE 
  key_id = '1f3f0e66cc4860bca68f57303533c622112356f6d190712c65e855b94a661004' 
  AND (
    token = 'WTGp9ymVyaaGGcspv/kj6O8LsMk/EcaOmXM5eU4OCVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058