UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TwO117578uzom9n9HXgwv773nJiW2qpjYVflW+pVGFY='
WHERE
key_id = 'b725101721447dc3afb1a45fd89d9a19792cda7a8b52189230ec88e2d54be683'
AND (
token = 'TwO117578uzom9n9HXgwv773nJiW2qpjYVflW+pVGFY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)