UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5XdgefuJJU5opu4UfLiw2+HtJgX4DkrzwOpTEBlbEq0='
WHERE
key_id = 'b29915a41df9f47d0c52f9c30d9e8d9ee13d0ba1962e345adafc10c577e73e85'
AND (
token = '5XdgefuJJU5opu4UfLiw2+HtJgX4DkrzwOpTEBlbEq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)