UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'shqQin88XXhh/UKgmVN77jiiz3n+TtPxoiMgalnDQkc=' 
WHERE 
  key_id = '1939adf4c19b1fa7b9c124788f5e4a3b5c4eda192f8b64b1ab724b38359f0666' 
  AND (
    token = 'shqQin88XXhh/UKgmVN77jiiz3n+TtPxoiMgalnDQkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029