UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qrVpZ+pS+yb3EymZIBxkmIkmkhM09WLtm51iB8RHBGY='
WHERE
key_id = '4a057be065b4bc5112bc911f549bb4594170aee9d6de8a6db2ead6e766972c1d'
AND (
token = 'qrVpZ+pS+yb3EymZIBxkmIkmkhM09WLtm51iB8RHBGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)