UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sg7287IdVfU39XUkh+Gs3hiktwgqaYIef1N868YCqUk='
WHERE
key_id = '613e2b113ea861759c97288ae6ae523595b73f6ffbeb1efd6bad3a367888c59a'
AND (
token = 'sg7287IdVfU39XUkh+Gs3hiktwgqaYIef1N868YCqUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)