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