UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a8Rt+2NYIA6IYIT/s4zEt2quaL2J33gpLyDETj4G6ug=' 
WHERE 
  key_id = 'fea51fe7f776117f6a83782a1bf09609fe181a9f452e41f646ee5c0e89dbdffd' 
  AND (
    token = 'a8Rt+2NYIA6IYIT/s4zEt2quaL2J33gpLyDETj4G6ug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030