UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lsxbg45NSIIzHshkVbfHzTorwnymZdk0bzaMkufB1b4='
WHERE
key_id = 'f5735f867f1e7993b284effd7574997f4339eddb12046e2ffe97eb3242319ab8'
AND (
token = 'lsxbg45NSIIzHshkVbfHzTorwnymZdk0bzaMkufB1b4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)