UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tj8xti5PFMktOqfTW4fFUQDaUE0kxoEKVVKxhlwBJzE=' 
WHERE 
  key_id = '2400ecc89f644cc8611d775878efb54b7e80bff3b6632f35662059fbdaa80e56' 
  AND (
    token = 'tj8xti5PFMktOqfTW4fFUQDaUE0kxoEKVVKxhlwBJzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022