UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X8DLGZgnh/Z0mW5Em3zlD/z0brJv24Jh7AGXgsHyezk=' 
WHERE 
  key_id = '4605da26ec509f9edb577b1dace10e46be627e8120c5ca4f2205a6d3a68190ad' 
  AND (
    token = 'X8DLGZgnh/Z0mW5Em3zlD/z0brJv24Jh7AGXgsHyezk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043