UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'njsQecqeBZRjS4bPpoGB99lYjaDfX9YWDnNPMS9iQk0='
WHERE
key_id = '9be1508d01b1b5b85753cbb8459a4892c070cfa0fbda6d27b5ac4071660a4729'
AND (
token = 'njsQecqeBZRjS4bPpoGB99lYjaDfX9YWDnNPMS9iQk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)