UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iT+DBnf2Tszf9isUGjQQkl3kuW0FRSF2T7Q3IrvH9B8=' 
WHERE 
  key_id = '4c6d32ce87e752eb45311d88c9ed39b04305175bb594f7e79d5d6bbbcb89912a' 
  AND (
    token = 'iT+DBnf2Tszf9isUGjQQkl3kuW0FRSF2T7Q3IrvH9B8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025