UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SAYJ6d1EXwPYHYMMXVEHNAWVnxZRzAg3TDu1P/0IwHw='
WHERE
key_id = 'd0086cab4c0d9eef32e09452b20147e7e3781498f8ea3cda7e52ca150ce64c6e'
AND (
token = 'SAYJ6d1EXwPYHYMMXVEHNAWVnxZRzAg3TDu1P/0IwHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)