UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cByHiscp+QWitLcUkfQetzvpnFHV2c9pUEzo25ZJ+hw=' 
WHERE 
  key_id = 'ec7042f0b305966066b88b3925b32b239fd0d473ca3db87f117a55fa365dcdff' 
  AND (
    token = 'cByHiscp+QWitLcUkfQetzvpnFHV2c9pUEzo25ZJ+hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069