UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RwZ10GZfYvBYDLyJn+PdZb69RIuyUXiDzZ2BIYuTEP8='
WHERE
key_id = 'cf2fdbd0076823cc9f5e82bdca43cd6a6ed911a92ac32886d035da5ddf094a20'
AND (
token = 'RwZ10GZfYvBYDLyJn+PdZb69RIuyUXiDzZ2BIYuTEP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)