UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ggOodhN+B2+uE0S99McSAylN4Jd8bchTlxLDhKdifE=' 
WHERE 
  key_id = 'a339aebf411e86956946642b8819fc06ff3d5c6fc43957d9bf9be8f6d31190b5' 
  AND (
    token = '5ggOodhN+B2+uE0S99McSAylN4Jd8bchTlxLDhKdifE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031