UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a2dKj91wi8oIzCQAZG5aeDfBvoUPiDBBLE+jYg57efk=' 
WHERE 
  key_id = '42731db9ba9f49ebbc5460247d0de1024e7287b71e60d0a18e612dc845444920' 
  AND (
    token = 'a2dKj91wi8oIzCQAZG5aeDfBvoUPiDBBLE+jYg57efk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043