UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J8Kq8lqgrD5Ou1SFkMbXA1qELYeJJ0vcDG4+O7v6RyU='
WHERE
key_id = '9a2630e83c05e2a673331a3f12656716947f651755cb3a33deb1bb0464b377ee'
AND (
token = 'J8Kq8lqgrD5Ou1SFkMbXA1qELYeJJ0vcDG4+O7v6RyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)