UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USOtHSOIr6K0eJVHvR8lyYGf9pZYMbxBbcdfGJDzroA='
WHERE
key_id = '1bcd7e0995342549e7384c8d5344e7cb99692b90822ec085d1a2376e23dd0a77'
AND (
token = 'USOtHSOIr6K0eJVHvR8lyYGf9pZYMbxBbcdfGJDzroA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)