UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gt/hYM73zszZCPmXPMdo1x6luMqSmxuv4i059HPSPJM=' 
WHERE 
  key_id = 'dcc247e88013e6ad6c4621295d8af9442aa188995c28140ce600caea0434196d' 
  AND (
    token = 'Gt/hYM73zszZCPmXPMdo1x6luMqSmxuv4i059HPSPJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032