UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+3CZedN7IjkXEZImjj52o+vZH7cVruGR9ODkjYpfqI='
WHERE
key_id = '05b22c5501caabfc9d544a5355ecf5764fa527a4d075acfb1f6e176280c8be26'
AND (
token = 'N+3CZedN7IjkXEZImjj52o+vZH7cVruGR9ODkjYpfqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)