UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dlqsokxCTyHRUxyTqq9+E6f37/tJDEGZgXAeNL4RJyo=' 
WHERE 
  key_id = '667cb19fba184aaaa8b1a964e69c1e8536bdc038ccb463f7a3d0f22d8bf9b87e' 
  AND (
    token = 'dlqsokxCTyHRUxyTqq9+E6f37/tJDEGZgXAeNL4RJyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037