UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qBoM88zI7Sp56wJixWsZI9YYvNWEETll7qDX3OpwKbU='
WHERE
key_id = 'ef1054515c4588e99f40171eaa3d3843cc4161d8eee8e440318c4dad73bb931c'
AND (
token = 'qBoM88zI7Sp56wJixWsZI9YYvNWEETll7qDX3OpwKbU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)