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