UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C0y2nr159HQ8b7yhOWxrHgFnv9HgMsxZHI+1y7J/vrg='
WHERE
key_id = '85290cb9e76fa740e429a263cf19eaba45f46cc27d7d5d76145768f02b6a5688'
AND (
token = 'C0y2nr159HQ8b7yhOWxrHgFnv9HgMsxZHI+1y7J/vrg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)