UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'smhic7r3TXh5GpaYgc4hBxCu5josFmyASzwHD4mOXa0='
WHERE
key_id = '6862686ccb70751a65f8952061b57bbb84ee14eb88199d95e339cc3a8c108589'
AND (
token = 'smhic7r3TXh5GpaYgc4hBxCu5josFmyASzwHD4mOXa0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)