UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UVDal1heAW4HBZ4kt2yGpEPVw1H+zMaRy1Co2etS430=' 
WHERE 
  key_id = '5f5130f69857c934cc65e8aa00dcf904c1183f0b21d70dcb24a946d9aecaf0e2' 
  AND (
    token = 'UVDal1heAW4HBZ4kt2yGpEPVw1H+zMaRy1Co2etS430=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022