UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tAhqJD1hHf9Y70KGBpwfoTsMxPT+O76TuIUoitLQf/E=' 
WHERE 
  key_id = '3699575baf74cfca4607d613aaff9d7b31a42092aec8acdc0ce931ebedba3ce3' 
  AND (
    token = 'tAhqJD1hHf9Y70KGBpwfoTsMxPT+O76TuIUoitLQf/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025