UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f61fTdVAjA4tp1Yd46YBXOffgSEIez32I2Q+42Y4TKs=' 
WHERE 
  key_id = '80fa611bc50dce83d1e71b033bcd5e0815ecec262ab2692485f9bee18160a712' 
  AND (
    token = 'f61fTdVAjA4tp1Yd46YBXOffgSEIez32I2Q+42Y4TKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018