UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RiZeLqPAGJKWoUswx7rQQk00iHboX2QfbF5r4DL2WfY='
WHERE
key_id = '12f592ac3c20607b57207f86ddddc9cab1b896e5b93c35f5b1e19c2fab92c599'
AND (
token = 'RiZeLqPAGJKWoUswx7rQQk00iHboX2QfbF5r4DL2WfY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)