UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pJbk21sC0LxwS7L+uRUPy9B4JZQBEPPraH5YYFmseY8='
WHERE
key_id = 'f19f2d7cbb664554b996d4fb1337214cc72dbc04f842b7d527e1d7f2f77a3626'
AND (
token = 'pJbk21sC0LxwS7L+uRUPy9B4JZQBEPPraH5YYFmseY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)