UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OlIMNbKj/tnWnTuH6SXHsgY5vXtm3e7LsY8C6KBwAzw=' 
WHERE 
  key_id = 'f70fa296d40a2734a145092a1c8e635e8f9671c9e37ce9997355217ef52db8e5' 
  AND (
    token = 'OlIMNbKj/tnWnTuH6SXHsgY5vXtm3e7LsY8C6KBwAzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025