UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eHfZfopBfyBQOtPUrD+YQkJVHYxhie+zfdbwGOxqFUk=' 
WHERE 
  key_id = 'ca6a81f1fb99c5663187719b9d4b5bd8842648edbacf8384797b7da85b238483' 
  AND (
    token = 'eHfZfopBfyBQOtPUrD+YQkJVHYxhie+zfdbwGOxqFUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036