UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fvo84LHi5GosjnCZCRan9TNKOVzFVUKGSbODSNbysT8=' 
WHERE 
  key_id = 'd6ba2416b064f35376fa6d72674f1c991dfce8cb8cddf41c854f6766148a5798' 
  AND (
    token = 'fvo84LHi5GosjnCZCRan9TNKOVzFVUKGSbODSNbysT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036