UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8o2K9kFktBwqqjk9yZ+jo4I0TwYSNttDwfwPk06FyAY='
WHERE
key_id = '18677f82c12f6a9a8b7f3f7ecaa2931c9297fafdc18705f8c2fca93900577992'
AND (
token = '8o2K9kFktBwqqjk9yZ+jo4I0TwYSNttDwfwPk06FyAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)