UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tK3N5haDZLGP1bm39RUVR9FeOdpAdjhbFKenCGoWhWg='
WHERE
key_id = '160afc34e4bdc58492f99a31746fb1354ed4f04fb4aa1fbfd3044ea3d56e4018'
AND (
token = 'tK3N5haDZLGP1bm39RUVR9FeOdpAdjhbFKenCGoWhWg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)