UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kwwrDwgraJf+SD/V6+6Dqh0qxKaQ30Wlx6Lj40krzpU='
WHERE
key_id = 'c6af6d9bba9cbda2891f5df84a655d701341a7519becb8128deb97964ef030ea'
AND (
token = 'kwwrDwgraJf+SD/V6+6Dqh0qxKaQ30Wlx6Lj40krzpU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)